/***********************************************************************//**
 *   \file Utility.h		\author belot nicolas (karrakis)           *
 *   \brief define Class Utility                                           
     Some utility function		                                   
 ************************************************************************//*
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef UTILITY_H
#define UTILITY_H 1

#include "libtrckr.h"
#include "Buffer.h"
#include <fftw3.h>
namespace libtrckr {
class Utility {
	/** \class libtrckr::Utility
	\brief Utility functions
	*/
	public:
	
	static const short MONOTONE_CUBIC = 0;
	static const short HANNING = 0;
	/** Interpolate with the specified type
	\param type type 
	\param eqx list of the absysse point
	\param eqy list of the ordonne point
	\param nx  size of the arrays eqx et eqy
	\param coeff array that store the new calculte ordonne point
	\param max size of the array coeff
	\param delta the size of the step beetwen coeff[i] and coeff[i+1]
	*/
	static void Interpolate(short, const double*, const double*, unsigned int, double*, unsigned int,double);
	static void Interpolate(short,  Buffer&,Buffer&, double);
	/** Perform an DFT transformation
	\param in array of data
	\param out the calculate DFT
	\param size size of the arrays
	*/
	static void FFT(fftw_complex*, fftw_complex*, unsigned int);
	/** Perform an inverse DFT transformation
	\param in the DFT
	\param out the calculate array of data
	\param size size of the arrays
	*/
	static void FFT_inverse(fftw_complex*, fftw_complex*, unsigned int);
	private:
	static void monotone_cubic(const double*, const double*, unsigned int, double*, unsigned int,double);
	static void monotone_cubic( Buffer&, Buffer&,double);
	/*static double h00(double);
	static double h01(double);
	static double h10(double);
	static double h11(double);*/
};
}
#endif

